I have written a script to scrape the data and show it in the system tray for Live Cricket Scores. How can I quit the application after selecting the match the score starts updating in the Tray but the application cannot be quit. Pls help me in it and also suggest any other changes if required. And Thankyou very very much all the videos tutorials.
import sys import requests import time from PySide import QtCore, QtGui from bs4 import BeautifulSoup from time import sleep I1 = [] I2 = [] Links=[] MInfo=[]
for item in inng1: I1.append(item.text.rstrip()) for item in inng2: I2.append(item.text.lstrip()) for l1,l2 in zip(I1,I2): MInfo.append(l1+ " Vs. " +l2)
data = soup.find_all("div",{"class":"match-articles"}) for item in data: scr1=item.find_all("a") Links.append("http://www.espncricinfo.com"+ scr1[0].get("href"))
for item in MInfo: action = menu.addAction(item) self.setContextMenu(menu) action.triggered[()].connect( lambda item=item: self.getScore(item))
w = QtGui.QWidget() trayIcon = SystemTrayIcon(QtGui.QIcon("C:Python34C.png"), w)
trayIcon.show() sys.exit(app.exec_())
if __name__ == '__main__': main()
You must be logged in to post. Please login or register an account.
Could have sworn I responded to this already. Normally seen, some form of sys.exit usually will do the trick, but not here, as they stay in the tray. I have personally never worked with the tray, and have no idea how you'd do it. I suggest asking in reddit or stackoverflow. I do not know of any pyside or pyqt reddit, but maybe try in the regular /r/python or /r/learnpython
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.